package pl.streamsoft.test.model.factory;

import java.util.Date;

import pl.streamsoft.test.model.CurrenciesDAO;
import pl.streamsoft.test.model.entities.CurrencyTypeEntity;
import pl.streamsoft.test.model.entities.DateEntryEntity;
import pl.streamsoft.test.model.exceptions.DAOException;

public class DummyFactory {

	public static DateEntryEntity createDateEntryEntity(CurrenciesDAO dao,
			Date date) throws DAOException {
		DateEntryEntity dateEntryEntity = new DateEntryEntity();
		dateEntryEntity.setValue(date);
		return dao.insert(dateEntryEntity);
	}

	public static DateEntryEntity createDateEntryEntity(CurrenciesDAO dao)
			throws DAOException {
		return createDateEntryEntity(dao, new Date());
	}

	public static CurrencyTypeEntity createCurrencyTypeEntity(CurrenciesDAO dao)
			throws DAOException {
		return createCurrencyTypeEntity(dao, "PLN");
	}

	public static CurrencyTypeEntity createCurrencyTypeEntity(
			CurrenciesDAO dao, String acronym) throws DAOException {
		CurrencyTypeEntity currencyTypeEntity = new CurrencyTypeEntity();
		currencyTypeEntity.setAcronym(acronym);
		return dao.insert(currencyTypeEntity);
	}

}
